package com.example.blog.service;

import com.example.blog.mapper.BlogMapper;
import com.example.blog.model.BlogInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BlogService {
    @Autowired
    private BlogMapper blogMapper;

    public List<BlogInfo> getList() {
       return blogMapper.selectAll();
    }

    public BlogInfo getBlogDetail(Integer id) {
        return blogMapper.getBlogDetail(id);
    }

    public Integer insertBlog(BlogInfo blog) {
        return blogMapper.insertBlog(blog);
    }

    public Integer deleteBlogById(@NonNull Integer blogId) {
        return blogMapper.deleteBlogById(blogId);
    }

    public Integer updateBlog(BlogInfo blog) {
        return blogMapper.updateBlog(blog);
    }
}
